Skip to main content
replaced http://stackapps.com/ with https://stackapps.com/
Source Link

Example of Explicit Authentication:

Explicit authentication is relatively straightforward with Stack.PY. Assuming you have already registered your applicationregistered your application, the instructions look something like this:

  1. Visit your application's pageapplication's page to obtain the following information:

    • key
    • client ID
    • client secret

  2. Provide Stack.PY with the above information:

     from stackpy import API
    
     # Fill in the strings with the appropriate values:
     API.key, API.client_id, API.client_secret = "", "", ""
    
  3. The API.begin_explicit() call consists of the following parameters:

    • a string consisting of the required privileges separated by commas
    • the URI to redirect the user to when the authorization completes
    • an optional string value to be returned with the access token when authorization completes

    Example:

     redirect_uri = API.begin_explicit('read_inbox,no_expiry',
                                       'http://example.com/done')
    

    The return value of the function is the URL that you will need to redirect the user to. That page will allow the user to authorize your application.

  4. The API.complete_explicit() call consists of the following parameters:

    • the value of the GET parameter code
    • the URI you provided to begin_explicit() above

    Example:

     access_token = API.complete_explicit(request.GET['code'],
                                          'http://example.com/done')
    

    The return value is the access token for the user.

Example of Explicit Authentication:

Explicit authentication is relatively straightforward with Stack.PY. Assuming you have already registered your application, the instructions look something like this:

  1. Visit your application's page to obtain the following information:

    • key
    • client ID
    • client secret

  2. Provide Stack.PY with the above information:

     from stackpy import API
    
     # Fill in the strings with the appropriate values:
     API.key, API.client_id, API.client_secret = "", "", ""
    
  3. The API.begin_explicit() call consists of the following parameters:

    • a string consisting of the required privileges separated by commas
    • the URI to redirect the user to when the authorization completes
    • an optional string value to be returned with the access token when authorization completes

    Example:

     redirect_uri = API.begin_explicit('read_inbox,no_expiry',
                                       'http://example.com/done')
    

    The return value of the function is the URL that you will need to redirect the user to. That page will allow the user to authorize your application.

  4. The API.complete_explicit() call consists of the following parameters:

    • the value of the GET parameter code
    • the URI you provided to begin_explicit() above

    Example:

     access_token = API.complete_explicit(request.GET['code'],
                                          'http://example.com/done')
    

    The return value is the access token for the user.

Example of Explicit Authentication:

Explicit authentication is relatively straightforward with Stack.PY. Assuming you have already registered your application, the instructions look something like this:

  1. Visit your application's page to obtain the following information:

    • key
    • client ID
    • client secret

  2. Provide Stack.PY with the above information:

     from stackpy import API
    
     # Fill in the strings with the appropriate values:
     API.key, API.client_id, API.client_secret = "", "", ""
    
  3. The API.begin_explicit() call consists of the following parameters:

    • a string consisting of the required privileges separated by commas
    • the URI to redirect the user to when the authorization completes
    • an optional string value to be returned with the access token when authorization completes

    Example:

     redirect_uri = API.begin_explicit('read_inbox,no_expiry',
                                       'http://example.com/done')
    

    The return value of the function is the URL that you will need to redirect the user to. That page will allow the user to authorize your application.

  4. The API.complete_explicit() call consists of the following parameters:

    • the value of the GET parameter code
    • the URI you provided to begin_explicit() above

    Example:

     access_token = API.complete_explicit(request.GET['code'],
                                          'http://example.com/done')
    

    The return value is the access token for the user.

Source Link
Nathan Osman
  • 23.3k
  • 11
  • 61
  • 107

Example of Explicit Authentication:

Explicit authentication is relatively straightforward with Stack.PY. Assuming you have already registered your application, the instructions look something like this:

  1. Visit your application's page to obtain the following information:

    • key
    • client ID
    • client secret

  2. Provide Stack.PY with the above information:

     from stackpy import API
    
     # Fill in the strings with the appropriate values:
     API.key, API.client_id, API.client_secret = "", "", ""
    
  3. The API.begin_explicit() call consists of the following parameters:

    • a string consisting of the required privileges separated by commas
    • the URI to redirect the user to when the authorization completes
    • an optional string value to be returned with the access token when authorization completes

    Example:

     redirect_uri = API.begin_explicit('read_inbox,no_expiry',
                                       'http://example.com/done')
    

    The return value of the function is the URL that you will need to redirect the user to. That page will allow the user to authorize your application.

  4. The API.complete_explicit() call consists of the following parameters:

    • the value of the GET parameter code
    • the URI you provided to begin_explicit() above

    Example:

     access_token = API.complete_explicit(request.GET['code'],
                                          'http://example.com/done')
    

    The return value is the access token for the user.