Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

Amber Web Authorization Framework

API Documentation
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Signals
  • Methods
  • Detailed Description

OAuth10a QML Type

A helper for OAuth10a flows. More...

Import Statement: import Amber.Web.Authorization 1.0
  • List of all members, including inherited members

Properties

  • accessTokenEndpoint : string
  • authorizeTokenEndpoint : string
  • consumerKey : string
  • consumerSecret : string
  • customParameters : string
  • redirectUri : string
  • requestTokenEndpoint : string
  • timeout : int
  • userAgent : string

Signals

  • errorOccurred(var code, var message)
  • receivedAccessToken(string oauthToken, string oauthSecret)
  • receivedAuthorizationCode(string oauthToken, string oauthVerifier)
  • receivedTemporaryToken(string oauthToken, string oauthSecret)

Methods

  • authorizationUrl(string oauthToken)
  • requestTemporaryToken()

Detailed Description

This helper type provides a simple API to allow the client application to request an access token from the remote OAuth10a-enabled service.

It integrates an OAuth1 helper and a RedirectListener helper, and exposes the various properties which are required for the OAuth10a flow.

Example of use:

 import QtQml 2.0
 import Amber.Web.Authorization 1.0

 OAuth10a {
     id: twitterOAuth

     property var xhr

     consumerKey: ""     // use your app's consumer_key value
     consumerSecret: ""  // use your app's consumer_secret value

     requestTokenEndpoint: "https://api.twitter.com/oauth/request_token"
     authorizeTokenEndpoint: "https://api.twitter.com/oauth/authorize"
     accessTokenEndpoint: "https://api.twitter.com/oauth/access_token"

     onErrorOccurred: console.log("Twitter OAuth1 Error: " + error.code + " = " + error.message + " : " + error.httpCode)

     onReceivedTemporaryToken: {
         console.log("Got temporary token: " + oauthToken)
         authorizeInBrowser(oauthToken, oauthTokenSecret)
     }

     onReceivedAccessToken: {
         console.log("Got access token: " + oauthToken + "; " + oauthTokenSecret)
         xhr = authenticatedRequest("GET", "https://api.twitter.com/1.1/account/verify_credentials.json",
                                    oauth1.generateAuthorizationHeader(
                                            oauthToken, oauthTokenSecret,
                                            "GET", "https://api.twitter.com/1.1/account/verify_credentials.json"))
     }

     function authenticatedRequest(method, url, authorization) {
         var req = new XMLHttpRequest()
         req.onreadystatechange = function() {
             if (req.readyState == XMLHttpRequest.DONE) {
                 var response = req.responseText
                 console.log(response)
             }
         }
         req.open(method, url)
         req.setRequestHeader("Authorization", authorization)
         req.send()
         return req
     }

     Component.onCompleted: twitterOAuth.requestTemporaryToken()
 }

See also OAuth1 and RedirectListener.

Property Documentation

accessTokenEndpoint : string

The accessTokenEndpoint value for the integrated OAuth1 helper.

It is a mandatory property.


authorizeTokenEndpoint : string

The authorizeTokenEndpoint value for the integrated OAuth1 helper.

It is a mandatory property.


consumerKey : string

The consumerKey value for the integrated OAuth1 helper.

It is a mandatory property.


consumerSecret : string

The consumerSecret value for the integrated OAuth1 helper.

It is a mandatory property.


customParameters : string

The customParameters value for the integrated OAuth1 helper.

Some services require some custom parameters to be specified at various stages of the OAuth1 flow, or will return more data if the client specifies particular custom parameters.

It is an optional property.


redirectUri : string

The redirectUri value for the integrated OAuth1 helper.

By default, it is bound to the uri value of the integrated RedirectListener helper, but the client application can set it to another URI if it is handling redirects manually.

It is a mandatory property.


requestTokenEndpoint : string

The requestTokenEndpoint value for the integrated OAuth1 helper.

It is a mandatory property.


timeout : int

The timeout value for the integrated RedirectListener helper.

It is an optional property.


userAgent : string

The userAgent value for the integrated OAuth1 helper.

It is an optional property.


Signal Documentation

errorOccurred(var code, var message)

This signal is emitted if an error occurs during the OAuth1 flow.


receivedAccessToken(string oauthToken, string oauthSecret)

This signal is emitted after receiving the access token and secret from the server.


receivedAuthorizationCode(string oauthToken, string oauthVerifier)

This signal is emitted after receiving the verifier code for the temporary token from the server.


receivedTemporaryToken(string oauthToken, string oauthSecret)

This signal is emitted after receiving the temporary token and secret from the server.


Method Documentation

authorizationUrl(string oauthToken)

Returns a valid authorization URL which can be loaded in the system web browser.

If the redirectUri is not manually specified by the client, the helper will automatically use the integrated RedirectListener helper and ensure that it starts listening.


requestTemporaryToken()

Requests a temporary token from the remote server.


  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn