Problem obtaining bearer token application_only auth



Attempting to get bearer token and seem to be having one of those days.Searched the threads and I have corrected some things such as end point, no dice. Returns 403 Forbidden.

This was supposed to be a quick test app written in with 2 methods, here is the latest code

 Private Function FORMAT_KEYS(ByVal sCONSUMERKEY_ As String, ByVal sSECRET_ As String) As String
        Dim sCONSUMERKEY As String
        Dim sSECRETKEY As String
        Dim sBASETOKEN As String
        Dim sBEARERTOKEN As String
        Dim baTOKEN() As Byte
            sCONSUMERKEY = UrlEncode(sCONSUMERKEY_)
            sSECRETKEY = UrlEncode(sSECRET_)
            baTOKEN = Encoding.UTF8.GetBytes(sBASETOKEN)
            sBEARERTOKEN = Convert.ToBase64String(baTOKEN)
            Return sBEARERTOKEN
        End Try
    End Function

 Private Function GET_ACCESS_TOKEN(ByVal sBEARERTOKEN_ As String) As String
        Dim objCLIENT As New WebClient()
        Dim baRESPONSE() As Byte
        Dim sRESPONSE As String
        Dim sURL As String
        Dim sDATA As String
        Dim baDATA() As Byte

            ' add the header
            objCLIENT.Headers.Add("Authorization", "Basic " & sBEARERTOKEN_)
            objCLIENT.Headers.Add("User-Agent", "SAIL-TWITTER-AGENT")
            objCLIENT.Headers.Add("Content-Type", "application/x-form-urlencoded,charset=UTF-8")
            ' set the url
            sURL = ""
            ' format the data to upload
            sDATA = "grant_type=client_credentials"
            baDATA = Encoding.UTF8.GetBytes(sDATA)
            ' upload the post values get response
            baRESPONSE = objCLIENT.UploadData(sURL, baDATA)
            sRESPONSE = System.Text.Encoding.UTF8.GetString(baRESPONSE)
            Return sRESPONSE
        Catch exc As Exception

            Return exc.ToString
        End Try
    End Function 

Read the documentation, looks right and so probably right in front of me. Overall should be simple, get the bearer token, use with search tweets REST api. No user, no posting. I was sort of hoping to get to the search portion before it died

Thanks in advance


“Do you know how to use that thing”
“Well yeah, at least I think I do” - Dr. Peter Vinckman