Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You will need to use both the Developer Key (API Key) and OAuth2. The developer key authenticates who wrote the software and is used for things like quota which is on a per developer basis not a per user basis. OAuth2 is for user authentication and will be need to access the non-public calendar.</p> <p>OAuth2 has a renew token from which you can generate a session token and this means that you will not need to screen scrape the OAuth screens to get authenticated. To get this I would write a little command line application, or you use a one off PHP page.</p> <ol> <li>Under the <a href="https://code.google.com/apis/console/" rel="nofollow">Google Api Console</a> go to API Access</li> <li>Generate a new Client ID and choose Installed Application ( as you will be authenticating you server as you not as your user)</li> <li>Either using a console app or a one off PHP page authenticate using OAuth and your google account (the one with the calendar you want access to)</li> <li>In the return from the authentication there should be a renew token, (called renew or refresh or something similar). Save this string and make it available to your PHP site.</li> <li>When you need to access the service your OAuth library should have a renew/refresh call. There is an example using .Net below.</li> </ol> <hr> <pre><code>private IAuthorizationState CreateAuthorization(NativeApplicationClient arg) { // Get the auth URL: IAuthorizationState state = new AuthorizationState(new[] { AdsenseService.Scopes.AdsenseReadonly.GetStringValue() }); state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl); if (refreshToken.IsNotNullOrEmpty()) // refreshToken you stored in step 4 { try { state.RefreshToken = refreshToken; if (arg.RefreshToken(state)) // This is calling out to the OAuth servers with the refresh token getting back a session token, returns true if successful. { if (state.RefreshToken != refreshToken) // if the refresh token has changed, save it. { PersistRefreshToken(authorization.RefreshToken); } return this.authorization = state; // Retain the authorization state, this is what will authenticate your calls. } } catch (ProtocolException ex) {...} </code></pre> <p>The AuthorisationState that has now been renewed can then be used to authenticate call you make to the API. this state can be used many time until it expires and then can be refreshed. As you are authenticating your application as yourself not as a user this AuthorisationState can be shared by all you sessions. Both the current AuthorisationState and the refresh token should be kept securely on your server and never sent to the client, if you ever sent these as part of a response your clients would have the same privileges as your code application</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload