The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. The following general process applies to all application types:
- When your application needs access to user data, it asks Google for a particular scope of access.
- Google displays a consent screen to the user, asking them to authorize your application to request some of their data.
- If the user approves, then Google gives your application a short-lived access token.
- Your application requests user data, attaching the access token to the request.
- If Google determines that your request and the token are valid, it returns the requested data.
Some flows include additional steps, such as using refresh tokens to acquire new access tokens. For detailed information about flows for various types of applications, see Google's OAuth 2.0 documentation.
Here's the OAuth 2.0 scope information for the Blogger APIs:
To request access using OAuth 2.0, your application needs the scope information, as well as information that Google supplies when you register your application (such as the client ID and the client secret).
Tip: The Google APIs client libraries can handle some of the authorization process for you. They are available for a variety of programming languages; check the page with libraries and samples for more details.
Acquiring and using an API key
Requests to the Blogger APIs for public data must be accompanied by an identifier, which can be an API key or an access token.
Or create one in the Credentials page.
After you have an API key, your application can append the query parameter key=yourAPIKey to all request URLs.
The API key is safe for embedding in URLs; it doesn't need any encoding.
Working with blogs
Retrieving a blog
You can retrieve information for a particular blog by sending an HTTP GET request to the blog's URI. The URI for a blog has the following format:
Request
A user does not need to be authenticated to retrieve a public blog. The application does not need to include Authorization HTTP header for a public blog request; however, you do need to provide the API key.
Blogger also has private blogs, which require authentication.
Komentar
Posting Komentar